<?php

namespace app\backstage\validate;

use think\Validate;

class DeductValidate extends Validate
{
    protected $rule = [
        'channel_id'  => 'require|number|gt:0',
        'user_group' => 'require|in:0,1',
        'register_day' => 'require|number|egt:0',
        'login_hour' => 'require|number|egt:0',
        'odds' => 'require|float|gt:0|elt:1',
        'field' => 'require',
        'value' => 'require',
    ];

    protected $message = [
        'channel_id.require' => '请选择代理',
        'odds.require' => '比例必须填写',
        'odds.float'    => '请输入正确格式的比例',
        'odds.gt'   => '比例必须大于0',
        'odds.elt'  => '比例必须小于等于1',
    ];

    protected $scene = [
        'addRule' => ['channel_id', 'user_group', 'register_day', 'login_hour', 'odds'],
        'changeField' => ['field','value'],
    ];
}